// 引入request
import request from '../util/request.js';

const DictRequest = {
    BASE_URL : "http://localhost:8084/tm",
    // 请求过程在这里开发，不在.vue文件中开发
    /**
     * 多条件分页查询toolType列表
     * @param toolType
     * @param callBack
     */
    loadToolType(toolType, callBack){
        // 拼接url  /sys/queryByPage?xxx
        let url = this.BASE_URL + "/toolType/queryByPage";
        // 调用request进行请求  http://lcation
        request.get(url,toolType,callBack);
    },
    /**
     * 新增设备类型的API
     * @param toolType
     * @param callBack
     */
    addToolType(toolType,callBack){
        let url = this.BASE_URL + "/toolType/save"
        request.post(url,toolType,callBack);
    },
    /**
     * 通过id加载设备类型信息的API
     * @param toolType
     * @param callBack
     */
    getById(toolTypeId,callBack){
        let url = this.BASE_URL + "/toolType/queryById?toolTypeId=" + toolTypeId;
        request.get(url,null,callBack);
    }
    ,
    /**
     * 修改设备类型信息的API
     * @param toolType
     * @param callBack
     */
    updateToolType(toolType,callBack){
        let url = this.BASE_URL + "/toolType/update";
        request.post(url,toolType,callBack);
    },
    /**
     *  删除设备类型的API
     * @param toolType
     * @param callBack
     */
    deleteToolType(toolTypeId,callBack){
        request.get(this.BASE_URL + "/toolType/delete?toolTypeId=" + toolTypeId,null,callBack);
    },
    /**
     * 批量删除设备类型的API
     * @param toolTypeIds
     * @param callBack
     */
    deleteToolTypes(toolTypeIds,callBack){
        let url = this.BASE_URL + "/toolType/deletes?a=1";
        for (let i = 0; i < toolTypeIds.length; i++){
            url += "&toolTypeIds="+toolTypeIds[i];
        }
        request.get(url,null,callBack);
    }
}
// 导出我们申明的dictrequest对象
export default DictRequest;